四维空间弹幕[弹].js 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. var rule = {
  2. author: '小虎斑',
  3. title: '小虎斑',
  4. host: 'https://4k-av.com',
  5. hostJs: '',
  6. headers: {
  7. 'User-Agent': 'IOS_UA'
  8. },
  9. 编码: 'utf-8',
  10. timeout: 5000,
  11. homeUrl: '/',
  12. url: '/fyclassfyfilter/page-fypage.html[/fyclassfyfilter]',
  13. filter_url: '{{fl.class}}',
  14. detailUrl: '',
  15. searchUrl: '/s?q=**',
  16. searchable: 1,
  17. quickSearch: 1,
  18. filterable: 1,
  19. class_name: '电影&剧集',
  20. class_url: 'movie&tv',
  21. filter_def: {},
  22. play_parse: true,
  23. proxy_rule: $js.toString(() => {
  24. if (input) {
  25. //console.log(url);
  26. var url = `http://dm.sds11.top/jsdm.php?id=` + input.url;
  27. var htt = fetch(url);
  28. input = [200, "text/xml", htt];
  29. }
  30. }),
  31. lazy: $js.toString(() => {
  32. console.log(VOD.name);
  33. const parts = input.split('|');
  34. if (/m3u8|mp4/.test(parts[0])) {
  35. // const parts = input.split('|');
  36. input = {
  37. jx: 0,
  38. parse: 0,
  39. url: parts[0],
  40. danmaku: getProxyUrl() + '&url=' + getYoukuVideoUrl(VOD.vod_name, parts[1])
  41. };
  42. } else {
  43. let matchResult = request(parts[0]).match(/<source src="(.*?)"/);
  44. let kurl = matchResult ? matchResult[1] : '';
  45. if (kurl) {
  46. input = {
  47. jx: 0,
  48. parse: 0,
  49. url: kurl,
  50. danmaku: getProxyUrl() + '&url=' + getYoukuVideoUrl(VOD.vod_name, parts[1])
  51. };
  52. } else {
  53. input = {
  54. jx: 0,
  55. parse: 1,
  56. url: parts[0],
  57. danmaku: getProxyUrl() + '&url=' + getYoukuVideoUrl(VOD.vod_name, parts[1])
  58. };
  59. }
  60. }
  61. }),
  62. limit: 9,
  63. double: false,
  64. 推荐: '*',
  65. 一级: '.NTMitem;a&&title;img&&src;.tags&&Text;a&&href',
  66. 二级: `js:
  67. let khtml = request(input);
  68. VOD = {};
  69. VOD.vod_id = input;
  70. VOD.vod_name = pdfh(khtml, '#tophead h1&&title') || '未知';
  71. VOD.vod_name = VOD.vod_name.split(' ')[0];
  72. VOD.type_name = pdfh(khtml, '.tags--span&&Text');
  73. VOD.vod_pic = pdfh(khtml, '#MainContent_poster&&img&&src');
  74. VOD.vod_remarks = pdfh(khtml, '.videodetail&&label:eq(0)&&Text');
  75. VOD.vod_year = pdfh(khtml, '.videodetail&&a&&Text');
  76. VOD.vod_area = pdfh(khtml, '.videodetail&&label:eq(1)&&Text');
  77. VOD.vod_director = '未知';
  78. VOD.vod_actor = '未知';
  79. VOD.vod_content = pdfh(khtml, '.videodesc&&Text');
  80. VOD.vod_play_from = '四维空间';
  81. let klists = [];
  82. let kcode = pdfa(khtml, 'ul#rtlist&&li');
  83. if ( kcode == 0) {
  84. kcode = pdfa(khtml, '#MainContent_poster&&a');
  85. kcode.forEach((kc) => {
  86. let kname = pdfh(kc, 'a&&title').replace('电影海报','');
  87. let khref = pdfh(kc, 'a&&href').replace('poster.jpg','');
  88. let klist = kname + '$' + khref + '|' + kname;;
  89. klists.push(klist);
  90. });
  91. VOD.vod_play_url = klists.join('#');
  92. } else {
  93. kcode;
  94. kcode.forEach((kc) => {
  95. let kname = pdfh(kc, 'span&&Text');
  96. let khref = pdfh(kc, 'img&&src').replace('screenshot.jpg','');
  97. let klist = kname + '$' + khref + '|' + kname;
  98. klists.push(klist);
  99. });
  100. VOD.vod_play_url = klists.join('#');
  101. }
  102. `,
  103. 搜索: '*',
  104. filter: {
  105. "tv": [{
  106. "key": "class",
  107. "name": "剧情",
  108. "value": [{
  109. "n": "全部",
  110. "v": ""
  111. }, {
  112. "n": "动作",
  113. "v": "/tag/动作"
  114. }, {
  115. "n": "剧情",
  116. "v": "/tag/剧情"
  117. }, {
  118. "n": "冒险",
  119. "v": "/tag/冒险"
  120. }, {
  121. "n": "喜剧",
  122. "v": "/tag/喜剧"
  123. }, {
  124. "n": "国产剧",
  125. "v": "/tag/国产剧"
  126. }, {
  127. "n": "恐怖",
  128. "v": "/tag/恐怖"
  129. }, {
  130. "n": "战争",
  131. "v": "/tag/战争"
  132. }, {
  133. "n": "科幻",
  134. "v": "/tag/科幻"
  135. }, {
  136. "n": "动画",
  137. "v": "/tag/动画"
  138. }, {
  139. "n": "韩剧",
  140. "v": "/tag/韩剧"
  141. }, {
  142. "n": "犯罪",
  143. "v": "/tag/犯罪"
  144. }, {
  145. "n": "纪录片",
  146. "v": "/tag/纪录片"
  147. }]
  148. },
  149. {
  150. "key": "class",
  151. "name": "剧情",
  152. "value": [{
  153. "n": "全部",
  154. "v": ""
  155. }, {
  156. "n": "2024",
  157. "v": "/2024"
  158. }, {
  159. "n": "2023",
  160. "v": "/2023"
  161. }, {
  162. "n": "2022",
  163. "v": "/2022"
  164. }, {
  165. "n": "2021",
  166. "v": "/2021"
  167. }, {
  168. "n": "2020",
  169. "v": "/2020"
  170. }, {
  171. "n": "2019",
  172. "v": "/2019"
  173. }]
  174. }
  175. ]
  176. }
  177. }
  178. globalThis.getYoukuVideoUrl = function(wd, flag) {
  179. try {
  180. let api = `https://search.youku.com/api/search?pg=1&keyword=${encodeURIComponent(wd)}`;
  181. let response = request(api);
  182. let json = JSON.parse(response);
  183. // 获取 showId
  184. let showId = json.pageComponentList?.[0]?.commonData?.showId;
  185. if (!showId) {
  186. throw new Error('ShowId not found.');
  187. }
  188. // 第二个 API 请求,获取集数信息
  189. api = `https://search.youku.com/api/search?appScene=show_episode&showIds=${showId}`;
  190. response = request(api);
  191. // 匹配 flag 中的 "第x集" 或 "第x话"
  192. json = JSON.parse(response);
  193. let matches = String(flag).match(/第\s*(\d+)\s*集/) ||
  194. String(flag).match(/第\s*(\d+)\s*话/) ||
  195. String(flag).match(/(\d+)/);
  196. let url = '';
  197. if (matches && matches[1]) {
  198. // 获取对应集数的 URL 或 videoId
  199. let episodeIndex = parseInt(matches[1], 10) - 1;
  200. url = json.serisesList?.[episodeIndex]?.url || json.serisesList?.[episodeIndex]?.videoId;
  201. }
  202. // 如果没有匹配到 flag,取第一个集数的 URL
  203. if (!url) {
  204. url = json.serisesList?.[0]?.url || json.serisesList?.[0]?.videoId;
  205. }
  206. // 如果 URL 不是以 http 开头,则拼接成完整的 Youku 视频地址
  207. if (url && !url.startsWith('http')) {
  208. url = `https://v.youku.com/v_show/id_${url}.html`;
  209. }
  210. return url || 'https://v.youku.com/';
  211. } catch {
  212. return 'https://v.youku.com/1111';
  213. }
  214. }